from sqlalchemy import engine, create_engine
from sqlalchemy.orm import session, sessionmaker

from config import CONFIG
from models.baseModel import BaseModel

print(CONFIG)
# 创建engine对象

engine = create_engine(CONFIG["DB_URI"],
                       echo=CONFIG["DB_ECHO"],
                       connect_args={'check_same_thread': False}
                       )
# 创建session对象
session = sessionmaker(engine)()

def create_metedata():
    BaseModel.metadata.create_all(engine)
    session.commit()

if __name__ == '__main__':
    create_metedata()